package com.example.tupu.repository;

import com.example.tupu.entity.Town;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface TownRepository extends Neo4jRepository<Town,Long> {
    List<Town> findAllByTitle(String title);

    List<Town> findAllByTitleLike(String title);

    @Query("match (n:Event)-[d:TOWN_IN]->(m:Town) where n.title=$title return m")
    List<Town> findTownByEvent(String title);
}
